local tanxu = fk.CreateSkill  {
  name = "xiaobai__tanxu",
}

Fk:loadTranslationTable{
  ["xiaobai__tanxu"] = "探虚",
  [":xiaobai__tanxu"] = "出牌阶段限一次，你可以获得一张【影】然后令一名其他角色视为对你使用【推心置腹】。"..
    "此牌结算后你展示所有手牌，若其中有【影】，你可以对其造成1点伤害。",
  
  ["#tanxu__choose_user"] = "探虚：请选择视为对你使用【推心置腹】的角色",
  ["#tanxu__damage"] = "探虚：是否对 %dest 造成1点伤害",

  ["$xiaobai__tanxu1"] = "外间谓公旧风发动，何意乃尔！",
  ["$xiaobai__tanxu2"] = "荆南风物、边陲治要，愿太傅教我。",
}

local U = require "packages.utility.utility"

tanxu:addEffect("active", {
  anim_type = "offensive",
  prompt = "#tanxu__choose_user",
  can_use = function (self, player)
    return player:usedSkillTimes(tanxu.name)<1 and #Fk:currentRoom().alive_players > 1
  end,
  card_filter = Util.FalseFunc,
  target_filter = function (self, player, to_select, selected, selected_cards, card, extra_data)
    return to_select ~= player and #selected == 0
  end,
  on_use = function (self, room, effect)
    local player = effect.from
    local target = effect.tos[1]
    player.room:moveCardTo(U.getShade(room, 1), Card.PlayerHand, player, fk.ReasonJustMove, tanxu.name, nil, true, player)
    if player.dead then return end

    room:useVirtualCard("sincere_treat", nil, target, {player}, tanxu.name, true)
    if player.dead then return end

    room:showCards(player:getCardIds("h"),player)
    if player.dead then return end

    if table.find(player:getCardIds("h"),function (element, index, array)
      return Fk:getCardById(element).trueName == "shade"
    end) then
      if room:askToSkillInvoke(player, {
        skill_name = tanxu.name,
        prompt = "#tanxu__damage::"..target.id}) then
        room:damage{
          from = player,
          to = target,
          damage = 1,
          skillName = tanxu.name
        }
      end
    end
  end
})

return tanxu